Skip to content

Conversation

@ntsekouras
Copy link
Contributor

What?

Load theme patterns only in block and site editor

Why?

From @jsnajdr 's comment:

Downloading and registering current theme patterns is not even limited to the editor pages, but is hooked to the init hook and happens for every page, even site frontend. See #38323

How?

This PR adds checks to fetch/register them only in block and site editor.

@ntsekouras ntsekouras added [Type] Bug An existing feature does not function as intended [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Mar 16, 2022
@ntsekouras ntsekouras requested a review from jsnajdr March 16, 2022 10:38
@ntsekouras ntsekouras self-assigned this Mar 16, 2022
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntsekouras ntsekouras force-pushed the update/load-theme-patterns-only-when-needed branch from 089a421 to ac9298f Compare March 16, 2022 19:47
@ntsekouras ntsekouras merged commit 7e3ecdc into trunk Mar 16, 2022
@ntsekouras ntsekouras deleted the update/load-theme-patterns-only-when-needed branch March 16, 2022 20:48
@github-actions github-actions bot added this to the Gutenberg 12.9 milestone Mar 16, 2022
@johnstonphilip
Copy link
Contributor

Just a heads up that this seems to break any block patterns that were registered on the current_screen hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants